Text-to-Speech API
POST
#
TTS https://api.botlhale.xyz/tts
tip
You need to include an
Authentication Token
in request headers. See the Authentication page of this documentation for information on how to generate authentication token codes.
This endpoint handles single text to speech conversion.
Request Params | Data Type | Description | |
---|---|---|---|
TextMsg | string | Required | This is the text message from the user to the bot. |
LanguageCode | string | Required | This is the language in which the user interacts with the bot. See the Supported Languages page for a list of supported languages and codes. |
#
Request Example- Python
- Bash
- JavaScript
- NodeJs - Request
import requests
url = "https://api.botlhale.xyz/tts"
payload={ 'LanguageCode': 'xh-ZA', 'TextMsg': 'Xa ufuna ukuthenga imoto cofa iqhosha lokuqala.' }files=[
]headers = { 'Authorization': 'Bearer <IdToken>'}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
curl --location --request POST 'https://api.botlhale.xyz/tts' \--header 'Authorization: Bearer <IdToken>' \--form 'LanguageCode="xh-ZA"' \--form 'TextMsg="Xa ufuna ukuthenga imoto cofa iqhosha lokuqala."'
var myHeaders = new Headers();myHeaders.append("Authorization", "Bearer <IdToken>");
var formdata = new FormData();formdata.append("LanguageCode", "xh-ZA");formdata.append("TextMsg", "Xa ufuna ukuthenga imoto cofa iqhosha lokuqala.");
var requestOptions = { method: 'POST', headers: myHeaders, body: formdata, redirect: 'follow'};
fetch("https://api.botlhale.xyz/tts", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
var request = require('request');var options = { 'method': 'POST', 'url': 'https://api.botlhale.xyz/tts', 'headers': { 'Authorization': 'Bearer <IdToken>' }, formData: { 'LanguageCode': 'xh-ZA', 'TextMsg': 'Xa ufuna ukuthenga imoto cofa iqhosha lokuqala.' }};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);});
#
Response body{ "DateReceived": "01/05/2021 15:38:35", "LanguageCode": "xh-ZA", "SpeechResponseURL": "<URL>", "TextMsg": "Xa ufuna ukuthenga imoto cofa iqhosha lokuqala."}
info
We are here to help! Please email support@botlhale.ai with any questions.